package com.kun.remote;

import com.kun.constant.ServiceConstant;
import com.kun.entity.SysPermission;
import com.kun.entity.SysUser;
import com.kun.remote.fallback.RemoteUserServiceFallBackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author kun.li
 */
@FeignClient(contextId = "remoteUserService",value = ServiceConstant.SYSTEM_SERVICE_NAME,path = "/user",
        fallbackFactory = RemoteUserServiceFallBackFactory.class)
public interface RemoteUserService {

    @GetMapping("/getSysUser")
    SysUser getSysUser(@RequestParam("username") String username,@RequestParam("userId") String userId);

    /**
     * 租户相关
     * @param tenantId
     * @param username
     * @param userId
     * @return
     */
    @GetMapping("/getSysUser/{tenantId}")
    SysUser getSysUser(@PathVariable("tenantId") String tenantId, @RequestParam("username") String username, @RequestParam("userId") String userId);

    @GetMapping("/selectPermission")
    List<SysPermission> selectPermission(@RequestParam("tenantId")String tenantId,@RequestParam("userId")String userId);

    @GetMapping("selectUserByDeptId")
    List<SysUser> selectUserByDeptId(@RequestParam("deptIds") String deptIds);
}
